package nz.broto.animatedlabel;

import java.util.ArrayList;

public class JXLabelMoveGroup {

	private ArrayList<JXLabelMove> allLabels = new ArrayList<JXLabelMove>();
	
	public void addJXLabelMove(JXLabelMove label){
		if (!allLabels.contains(label)){
			allLabels.add(label);
			label.setGroup(this);
		}
	}
	
	public void removeJXLabelMove(JXLabelMove label){
		if (allLabels.contains(label)){
			allLabels.remove(label);
			label.setGroup(null);
		}
	}
	
	public void mousePassed(JXLabelMove label){
		removeJXLabelMove(label);
		
		for (int i=0; i<allLabels.size(); i++){
			allLabels.get(i).setState(JXLabelMove.BASE_STATE);
		}
		
		addJXLabelMove(label);
	}
}
